---
title: Liam ERD CLI
---

import { Tab, Tabs } from 'fumadocs-ui/components/tabs'; // For package-install code blocks

## Quick Start

The fastest way to get started with Liam ERD is using the interactive setup command:

```npm
npx @liam-hq/cli init
```

## Manual Setup

For more control over the ERD generation process, you can use the `erd` command directly:

### Basic Usage

Generate an ERD from your schema file using the following command:

```npm
npx @liam-hq/cli erd build --input <path|url>
```

This command processes your schema file and generates interactive ERD visualization files in the `dist` directory. The schema format is automatically detected (see [Format Auto-Detection](/docs/parser/supported-formats#format-auto-detection)), but you can override it using the `--format` option if needed. Also, output directory can be specified by `--output-dir` option.

Once the ERD is generated, you can view it by serving the files using a local HTTP server:

```npm
npx serve dist/  # or your custom output directory
```

The server will start and provide you with a local URL (typically http://localhost:3000) where you can view your ERD in a web browser.

You can use any hosting service of your choice to serve the generated files.

### Options

- `--input <path|url>`: Path to your schema file or URL
- `--format <format>`: (Optional) Override the auto-detected schema format
- `--output-dir <path>`: (Optional) Specify the output directory for generated files (default: "dist")

### From GitHub Public Repository

You can directly specify URLs to schema files stored in public GitHub repositories. Using raw URLs allows you to generate ERDs directly from remote schema files.

```npm
npx @liam-hq/cli erd build --input https://github.com/user/repo/blob/main/examples/schema.sql --format postgres
```

```npm
npx @liam-hq/cli erd build --input https://raw.githubusercontent.com/user/repo/main/examples/schema.sql --format postgres
```


### Output

The command generates a simple web application using [Vite](https://vite.dev/), which includes JavaScript, CSS, and HTML files, in the `dist` directory of your current working directory (or the directory specified by `--output-dir` option).

To view the generated ERD, serve the output directory using any HTTP server:

```npm
npx serve dist/  # or your custom output directory
```

## Sample Projects

For sample projects and setup examples, check out our [liam-erd-samples](https://github.com/liam-hq/liam-erd-samples) repository.
